package com.ningmengs789.live.ui.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.ningmengs789.live.R;
import com.ningmengs789.live.model.GoodslistDTO;
import com.ningmengs789.live.utils.GlideUtil;
import com.youth.banner_lod.RadiuImageView;

import java.util.List;

/**
 * 作者 : Administrator (yzhg)
 * 时间 : 2021-09-08 10:51
 * 包名 : com.ningmengs789.live.ui.adapter
 * 备注：积分商城适配器
 */
public class IntegralShoppingAdapter extends BaseRecyclerViewAdapter {


    public IntegralShoppingAdapter(Context context, List data, int layoutId) {
        super(context, data, layoutId);
    }

    @Override
    protected void onBindData(RecyclerViewHolder holder, Object bean, int position) {
        GoodslistDTO goodslistDTO = (GoodslistDTO) bean;

        //商品的图标
        RadiuImageView integralIcon = holder.itemView.findViewById(R.id.tv_integral_icon);

        //商品标题
        TextView tvGoodsName = holder.itemView.findViewById(R.id.tv_goods_name);

        //兑换商品所需要的积分
        TextView tvIntegralNum = holder.itemView.findViewById(R.id.tv_integral_num);

        //兑换按钮
        TextView tvIntegralConversion = holder.itemView.findViewById(R.id.tv_integral_conversion);

        //设置商品图片
       // GlideUtil.loadImageView(mContext, goodslistDTO.getImageFrist(), integralIcon);
        RoundedCorners roundedCorners = new RoundedCorners(16);
        RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
        Glide.with(mContext)
                .load(goodslistDTO.getImageFrist())
                .apply(options)
                .into(integralIcon);

        //设置商品标题
        tvGoodsName.setText(goodslistDTO.getGoodsName());

        //设置兑换所需要的积分
        tvIntegralNum.setText(String.valueOf(goodslistDTO.getSalesActual()) + "积分");

        


    }
}
